<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>驼峰式写法</title>
</head>

<body>

</body>
<script>
    let str = 'border-left-color'
    let st = str.split('-')
    console.log(st);
    for (let i = 1; i < st.length; i++) {
        let newSt = st[i].match(/\w/)//找到第一个就不找了
        console.log(newSt);
        let j = newSt[0].toUpperCase()
        st[i] = st[i].replace(/\w/, j)
    }
    let str1 = st.join('')
    console.log(str1);
</script>

</html>